
#ifdef a
//基类对子类的引用/指针直接访问子类？
#include<iostream>
using namespace std;
class Base {
public:
	Base(int b)
		:_b(b)
	{}
	void Fun1() {
		cout << "Base Base1" << endl;
	}
	
	void Fun2() {
		cout << "Base Base2" << endl;
	}

	int _b;
};

class Child : public Base 
{
public:
	Child(int b, int c)
		:Base(b)
		,_c(c)
	{}
	void Fun1() {
		cout << "Child Fun1" << endl;
	}
	void CFun() {
		cout << "Child CFun" << endl;
	}
	int _c;
};
int main() {
	Base b = Child(1, 2);//相当于基类对子类的引用
	b.Fun1();
	b.Base::Fun1();
	b.Fun2();
	
	//不能对子类进行个性访问
//	b.Child::Fun1();
//	b.CFun();
	
	Base* pb = new Child(100, 200);
	pb->Fun1();
	
	//同样不可对子类访问
	//pb->Child::Fun1();
	//pb->CFun();
	return 0;
}
#endif